<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI面试官 - 个人中心</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/boxicons@2.0.7/css/boxicons.min.css" rel="stylesheet">
    <link href="/static/css/style.css" rel="stylesheet">
    <link href="/static/css/dashboard.css" rel="stylesheet">
    <link href="/static/css/candidate/profile.css" rel="stylesheet">
    <style>
        .profile-container {
            padding: 20px;
        }
        .profile-card {
            background-color: #f8f9fa;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 20px;
        }
        .profile-details {
            background-color: #f8f9fa;
            border-radius: 10px;
            padding: 20px;
        }
        .info-item {
            margin-bottom: 15px;
        }
        .cards {
  display: flex;
  {#flex-direction: column;#}
  gap: 15px;
}

.cards .red {
  background-color: #f43f5e;
}

.cards .blue {
  background-color: #3b82f6;
}

.cards .green {
  background-color: #22c55e;
}

.cards .card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  height: 100px;
  width: 250px;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  transition: 400ms;
}

.cards .card p.tip {
  font-size: 1em;
  font-weight: 700;
}

.cards .card p.second-text {
  font-size: .7em;
}

.cards .card:hover {
  transform: scale(1.1, 1.1);
}

/* From Uiverse.io by _7754 */
.feedback {
  --normal: #414052;
  --normal-shadow: #313140;
  --normal-shadow-top: #4c4b60;
  --normal-mouth: #2e2e3d;
  --normal-eye: #282734;
  --active: #f8da69;
  --active-shadow: #f4b555;
  --active-shadow-top: #fff6d3;
  --active-mouth: #f05136;
  --active-eye: #313036;
  --active-tear: #76b5e7;
  --active-shadow-angry: #e94f1d;
  --hover: #454456;
  --hover-shadow-top: #59586b;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
}
.feedback label {
  position: relative;
  transition: transform 0.3s;
  cursor: pointer;
}
.feedback label:not(:last-child) {
  margin-right: 20px;
}
.feedback label input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  outline: none;
  border: none;
  display: block;
  position: absolute;
  width: 40px;
  height: 40px;
  left: 0;
  top: 0;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--sb, var(--normal));
  box-shadow:
    inset 3px -3px 4px var(--sh, var(--normal-shadow)),
    inset -1px 1px 2px var(--sht, var(--normal-shadow-top));
  transition:
    background 0.4s,
    box-shadow 0.4s,
    transform 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.feedback label div {
  width: 40px;
  height: 40px;
  position: relative;
  transform: perspective(240px) translateZ(4px);
}
.feedback label div svg,
.feedback label div:before,
.feedback label div:after {
  display: block;
  position: absolute;
  left: var(--l, 9px);
  top: var(--t, 13px);
  width: var(--w, 8px);
  height: var(--h, 1px);
  transform: rotate(var(--r, 0deg)) scale(var(--sc, 1)) translateZ(0);
}
.feedback label div svg {
  fill: none;
  stroke: var(--s);
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.4s;
}
.feedback label div svg.eye {
  --s: var(--e, var(--normal-eye));
  --t: 17px;
  --w: 7px;
  --h: 4px;
}
.feedback label div svg.eye.right {
  --l: 23px;
}
.feedback label div svg.mouth {
  --s: var(--m, var(--normal-mouth));
  --l: 11px;
  --t: 23px;
  --w: 18px;
  --h: 7px;
}
.feedback label div:before,
.feedback label div:after {
  content: "";
  z-index: var(--zi, 1);
  border-radius: var(--br, 1px);
  background: var(--b, var(--e, var(--normal-eye)));
  transition: background 0.4s;
}
.feedback label.angry {
  --step-1-rx: -24deg;
  --step-1-ry: 20deg;
  --step-2-rx: -24deg;
  --step-2-ry: -20deg;
}
.feedback label.angry div:before {
  --r: 20deg;
}
.feedback label.angry div:after {
  --l: 23px;
  --r: -20deg;
}
.feedback label.angry div svg.eye {
  stroke-dasharray: 4.55;
  stroke-dashoffset: 8.15;
}
.feedback label.angry input:checked {
  -webkit-animation: angry 1s linear;
  animation: angry 1s linear;
}
.feedback label.angry input:checked + div:before {
  --middle-y: -2px;
  --middle-r: 22deg;
  -webkit-animation: toggle 0.8s linear forwards;
  animation: toggle 0.8s linear forwards;
}
.feedback label.angry input:checked + div:after {
  --middle-y: 1px;
  --middle-r: -18deg;
  -webkit-animation: toggle 0.8s linear forwards;
  animation: toggle 0.8s linear forwards;
}
.feedback label.sad {
  --step-1-rx: 20deg;
  --step-1-ry: -12deg;
  --step-2-rx: -18deg;
  --step-2-ry: 14deg;
}
.feedback label.sad div:before,
.feedback label.sad div:after {
  --b: var(--active-tear);
  --sc: 0;
  --w: 5px;
  --h: 5px;
  --t: 15px;
  --br: 50%;
}
.feedback label.sad div:after {
  --l: 25px;
}
.feedback label.sad div svg.eye {
  --t: 16px;
}
.feedback label.sad div svg.mouth {
  --t: 24px;
  stroke-dasharray: 9.5;
  stroke-dashoffset: 33.25;
}
.feedback label.sad input:checked + div:before,
.feedback label.sad input:checked + div:after {
  -webkit-animation: tear 0.6s linear forwards;
  animation: tear 0.6s linear forwards;
}
.feedback label.ok {
  --step-1-rx: 4deg;
  --step-1-ry: -22deg;
  --step-1-rz: 6deg;
  --step-2-rx: 4deg;
  --step-2-ry: 22deg;
  --step-2-rz: -6deg;
}
.feedback label.ok div:before {
  --l: 12px;
  --t: 17px;
  --h: 4px;
  --w: 4px;
  --br: 50%;
  box-shadow: 12px 0 0 var(--e, var(--normal-eye));
}
.feedback label.ok div:after {
  --l: 13px;
  --t: 26px;
  --w: 14px;
  --h: 2px;
  --br: 1px;
  --b: var(--m, var(--normal-mouth));
}
.feedback label.ok input:checked + div:before {
  --middle-s-y: 0.35;
  -webkit-animation: toggle 0.2s linear forwards;
  animation: toggle 0.2s linear forwards;
}
.feedback label.ok input:checked + div:after {
  --middle-s-x: 0.5;
  -webkit-animation: toggle 0.7s linear forwards;
  animation: toggle 0.7s linear forwards;
}
.feedback label.good {
  --step-1-rx: -14deg;
  --step-1-rz: 10deg;
  --step-2-rx: 10deg;
  --step-2-rz: -8deg;
}
.feedback label.good div:before {
  --b: var(--m, var(--normal-mouth));
  --w: 5px;
  --h: 5px;
  --br: 50%;
  --t: 22px;
  --zi: 0;
  opacity: 0.5;
  box-shadow: 16px 0 0 var(--b);
  filter: blur(2px);
}
.feedback label.good div:after {
  --sc: 0;
}
.feedback label.good div svg.eye {
  --t: 15px;
  --sc: -1;
  stroke-dasharray: 4.55;
  stroke-dashoffset: 8.15;
}
.feedback label.good div svg.mouth {
  --t: 22px;
  --sc: -1;
  stroke-dasharray: 13.3;
  stroke-dashoffset: 23.75;
}
.feedback label.good input:checked + div svg.mouth {
  --middle-y: 1px;
  --middle-s: -1;
  -webkit-animation: toggle 0.8s linear forwards;
  animation: toggle 0.8s linear forwards;
}
.feedback label.happy div {
  --step-1-rx: 18deg;
  --step-1-ry: 24deg;
  --step-2-rx: 18deg;
  --step-2-ry: -24deg;
}
.feedback label.happy div:before {
  --sc: 0;
}
.feedback label.happy div:after {
  --b: var(--m, var(--normal-mouth));
  --l: 11px;
  --t: 23px;
  --w: 18px;
  --h: 8px;
  --br: 0 0 8px 8px;
}
.feedback label.happy div svg.eye {
  --t: 14px;
  --sc: -1;
}
.feedback label.happy input:checked + div:after {
  --middle-s-x: 0.95;
  --middle-s-y: 0.75;
  -webkit-animation: toggle 0.8s linear forwards;
  animation: toggle 0.8s linear forwards;
}
.feedback label input:checked {
  --sb: var(--active);
  --sh: var(--active-shadow);
  --sht: var(--active-shadow-top);
}
.feedback label input:checked + div {
  --m: var(--active-mouth);
  --e: var(--active-eye);
  -webkit-animation: shake 0.8s linear forwards;
  animation: shake 0.8s linear forwards;
}
.feedback label input:not(:checked):hover {
  --sb: var(--hover);
  --sht: var(--hover-shadow-top);
}
.feedback label input:not(:checked):active {
  transform: scale(0.925);
}
.feedback label input:not(:checked):active + div {
  transform: scale(0.925);
}
.feedback label:hover {
  transform: scale(1.08);
}

@-webkit-keyframes shake {
  30% {
    transform: perspective(240px) rotateX(var(--step-1-rx, 0deg))
      rotateY(var(--step-1-ry, 0deg)) rotateZ(var(--step-1-rz, 0deg))
      translateZ(10px);
  }
  60% {
    transform: perspective(240px) rotateX(var(--step-2-rx, 0deg))
      rotateY(var(--step-2-ry, 0deg)) rotateZ(var(--step-2-rz, 0deg))
      translateZ(10px);
  }
  100% {
    transform: perspective(240px) translateZ(4px);
  }
}

@keyframes shake {
  30% {
    transform: perspective(240px) rotateX(var(--step-1-rx, 0deg))
      rotateY(var(--step-1-ry, 0deg)) rotateZ(var(--step-1-rz, 0deg))
      translateZ(10px);
  }
  60% {
    transform: perspective(240px) rotateX(var(--step-2-rx, 0deg))
      rotateY(var(--step-2-ry, 0deg)) rotateZ(var(--step-2-rz, 0deg))
      translateZ(10px);
  }
  100% {
    transform: perspective(240px) translateZ(4px);
  }
}
@-webkit-keyframes tear {
  0% {
    opacity: 0;
    transform: translateY(-2px) scale(0) translateZ(0);
  }
  50% {
    transform: translateY(12px) scale(0.6, 1.2) translateZ(0);
  }
  20%,
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(24px) translateX(4px) rotateZ(-30deg) scale(0.7, 1.1)
      translateZ(0);
  }
}
@keyframes tear {
  0% {
    opacity: 0;
    transform: translateY(-2px) scale(0) translateZ(0);
  }
  50% {
    transform: translateY(12px) scale(0.6, 1.2) translateZ(0);
  }
  20%,
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(24px) translateX(4px) rotateZ(-30deg) scale(0.7, 1.1)
      translateZ(0);
  }
}
@-webkit-keyframes toggle {
  50% {
    transform: translateY(var(--middle-y, 0))
      scale(
        var(--middle-s-x, var(--middle-s, 1)),
        var(--middle-s-y, var(--middle-s, 1))
      )
      rotate(var(--middle-r, 0deg));
  }
}
@keyframes toggle {
  50% {
    transform: translateY(var(--middle-y, 0))
      scale(
        var(--middle-s-x, var(--middle-s, 1)),
        var(--middle-s-y, var(--middle-s, 1))
      )
      rotate(var(--middle-r, 0deg));
  }
}
@-webkit-keyframes angry {
  40% {
    background: var(--active);
  }
  45% {
    box-shadow:
      inset 3px -3px 4px var(--active-shadow),
      inset 0 8px 10px var(--active-shadow-angry);
  }
}
@keyframes angry {
  40% {
    background: var(--active);
  }
  45% {
    box-shadow:
      inset 3px -3px 4px var(--active-shadow),
      inset 0 8px 10px var(--active-shadow-angry);
  }
}

/* 自定义模态框样式 */
.modal-content {
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}
.modal-header {
    background-color: #f8f9fa;
    border-bottom: none;
}
.modal-title {
    font-weight: bold;
}
.modal-body {
    padding: 20px;
}
.info-item {
    margin-bottom: 15px;
}
.info-item label {
    display: block;
    margin-bottom: 5px;
}
.info-item input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}





    </style>
</head>
<body class="dashboard-page">
    <div class="dashboard-container">
        <!-- 侧边栏 -->
        <nav id="sidebar">
            <div class="sidebar-header">
                <div class="logo">
                    <i class='bx bx-bot'></i>
                    <span>AI面试官</span>
                </div>
            </div>
            <ul class="nav-links">
                <li>
                    <a href="/applicant/dashboard">
                        <i class='bx bxs-dashboard'></i>
                        <span>控制台</span>
                    </a>
                </li>
{#                <li>#}
{#                    <a href="/applicant/sim_interview">#}
{#                        <i class='bx bx-video'></i>#}
{#                        <span>模拟面试</span>#}
{#                    </a>#}
{#                </li>#}
                <li>
                    <a href="/applicant/interview">
                        <i class='bx bx-video'></i>
                        <span>面试中心</span>
                    </a>
                </li>
                <li>
                    <a href="/applicant/dashboard" data-bs-toggle="collapse" data-bs-target="#resumeMenu" aria-expanded="false" aria-controls="resumeMenu">
                        <i class='bx bx-file'></i>
                        <span>简历中心</span>
                        <i class='bx bx-chevron-down'></i> <!-- 添加展开图标 -->
                    </a>
                    <ul class="collapse" id="resumeMenu">
                        <li>
                            <a href="/applicant/resume">
                                <i class='bx bx-file'></i>
                                <span>简历上传</span>
                            </a>
                        </li>
                        <li>
                            <a href="/applicant/analyze_resume">
                                <i class='bx bx-file'></i>
                                <span>简历分析</span>
                            </a>
                        </li>
                        <li>
                            <a href="/applicant/upload_resume">
                                <i class='bx bx-file'></i>
                                <span>投递简历</span>
                            </a>
                        </li>
                        <li>
                            <a href="/applicant/resume_manage">
                                <i class='bx bx-file'></i>
                                <span>简历管理</span>
                            </a>
                        </li>
                    </ul>
                </li>




                <li class="active">
                    <a href="/applicant/personal_center">
                        <i class='bx bx-user'></i>
                        <span>个人中心</span>
                    </a>
                </li>
            </ul>
        </nav>

        <!-- 主要内容区域 -->
        <main class="main-content">
            <div class="profile-container">
                <!-- 基本信息卡片 -->
                <div class="profile-card">
                    <div class="profile-header">
                        <div class="avatar-section">
                            <div class="avatar">
                                <img src="{{ url_for('static', filename='applicant_logo/用户头像.jpg') }}" alt="用户头像">
                                <button class="edit-avatar">
                                    <i class='bx bx-camera'></i>
                                </button>
                            </div>
                            <div class="user-info">
                                <h2 id="full-name"></h2>
                                <p id="expected-position"></p>
                            </div>
                        </div>
                        <button class="btn btn-primary edit-profile" id="edit-profile-btn">
                            <i class='bx bx-edit'></i>
                            编辑资料
                        </button>
                    </div>
                </div>

                <!-- 详细信息区域 -->
                <div class="profile-details">
                    <div class="details-section">
                        <h3>个人信息</h3>

                        <div class="cards">
                            <div class="card red">
                                <p class="tip" id="full-name-show"></p>
                                <p class="second-text">姓名</p>
                            </div>

                            <div class="card blue">
                                <p class="tip" id="email-show"></p>
                                <p class="second-text">邮箱</p>
                            </div>

                            <div class="card green">
                                <p class="tip" id="phone-show">Hover Me</p>
                                <p class="second-text">电话号</p>
                            </div>

                            <div class="card blue">
                                <p class="tip" id="expected-salary-show"></p>
                                <p class="second-text">期望薪资</p>
                            </div>

                            <div class="card red">
                                <p class="tip" id="expected-position-show">Hover Me</p>
                                <p class="second-text">期望职位</p>
                            </div>
                        </div>

                    </div>
                </div>

                <div class="profile-details">
                    <div class="details-section">
                        <h3>系统功能评价</h3>
                        <!-- From Uiverse.io by _7754 -->
                        <h5>系统使用满意度</h5>
                        <div class="feedback">
                          <label class="angry">
                            <input name="feedback" value="1" type="radio" />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                              <svg class="mouth"></svg>
                            </div>
                          </label>
                          <label class="sad">
                            <input name="feedback" value="2" type="radio" />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                              <svg class="mouth"></svg>
                            </div>
                          </label>
                          <label class="ok">
                            <input name="feedback" value="3" type="radio" />
                            <div></div>
                          </label>
                          <label class="good">
                            <input checked="" name="feedback" value="4" type="radio" />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                              <svg class="mouth"></svg>
                            </div>
                          </label>
                          <label class="happy">
                            <input name="feedback" value="5" type="radio" checked />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                            </div>
                          </label>
                        </div>
                        <svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
  <symbol id="eye" viewBox="0 0 7 4" xmlns="http://www.w3.org/2000/svg">
    <path
      d="M1,1 C1.83333333,2.16666667 2.66666667,2.75 3.5,2.75 C4.33333333,2.75 5.16666667,2.16666667 6,1"
    ></path>
  </symbol>
  <symbol id="mouth" viewBox="0 0 18 7" xmlns="http://www.w3.org/2000/svg">
    <path
      d="M1,5.5 C3.66666667,2.5 6.33333333,1 9,1 C11.6666667,1 14.3333333,2.5 17,5.5"
    ></path>
  </symbol>
</svg>

                        <h5>简历分析功能满意度</h5>
                        <div class="feedback">
                          <label class="angry">
                            <input name="feedback2" value="1" type="radio" />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                              <svg class="mouth"></svg>
                            </div>
                          </label>
                          <label class="sad">
                            <input name="feedback2" value="2" type="radio" />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                              <svg class="mouth"></svg>
                            </div>
                          </label>
                          <label class="ok">
                            <input name="feedback2" value="3" type="radio" />
                            <div></div>
                          </label>
                          <label class="good">
                            <input checked="" name="feedback2" value="4" type="radio" />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                              <svg class="mouth"></svg>
                            </div>
                          </label>
                          <label class="happy">
                            <input name="feedback2" value="5" type="radio" checked />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                            </div>
                          </label>
                        </div>
                        <svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
  <symbol id="eye" viewBox="0 0 7 4" xmlns="http://www.w3.org/2000/svg">
    <path
      d="M1,1 C1.83333333,2.16666667 2.66666667,2.75 3.5,2.75 C4.33333333,2.75 5.16666667,2.16666667 6,1"
    ></path>
  </symbol>
  <symbol id="mouth" viewBox="0 0 18 7" xmlns="http://www.w3.org/2000/svg">
    <path
      d="M1,5.5 C3.66666667,2.5 6.33333333,1 9,1 C11.6666667,1 14.3333333,2.5 17,5.5"
    ></path>
  </symbol>
</svg>

                        <h5>AI面试功能满意度</h5>
                        <div class="feedback">
                          <label class="angry">
                            <input name="feedback3" value="1" type="radio" />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                              <svg class="mouth"></svg>
                            </div>
                          </label>
                          <label class="sad">
                            <input name="feedback3" value="2" type="radio" />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                              <svg class="mouth"></svg>
                            </div>
                          </label>
                          <label class="ok">
                            <input name="feedback3" value="3" type="radio" />
                            <div></div>
                          </label>
                          <label class="good">
                            <input checked="" name="feedback3" value="4" type="radio" />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                              <svg class="mouth"></svg>
                            </div>
                          </label>
                          <label class="happy">
                            <input name="feedback3" value="5" type="radio" checked />
                            <div>
                              <svg class="eye left"></svg>
                              <svg class="eye right"></svg>
                            </div>
                          </label>
                        </div>
                        <svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
  <symbol id="eye" viewBox="0 0 7 4" xmlns="http://www.w3.org/2000/svg">
    <path
      d="M1,1 C1.83333333,2.16666667 2.66666667,2.75 3.5,2.75 C4.33333333,2.75 5.16666667,2.16666667 6,1"
    ></path>
  </symbol>
  <symbol id="mouth" viewBox="0 0 18 7" xmlns="http://www.w3.org/2000/svg">
    <path
      d="M1,5.5 C3.66666667,2.5 6.33333333,1 9,1 C11.6666667,1 14.3333333,2.5 17,5.5"
    ></path>
  </symbol>
</svg>

                </div>
            </div>
            </div>
        </main>
    </div>

    <!-- 模态框 -->
<div class="modal fade" id="editProfileModal" tabindex="-1" aria-labelledby="editProfileModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="editProfileModalLabel">编辑资料</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <form id="profile-form">
                    <div class="info-grid">
                        <div class="info-item">
                            <label>姓名</label>
                            <input type="text" name="full_name" id="full-name-input" value="">
                        </div>
                        <div class="info-item">
                            <label>邮箱</label>
                            <input type="email" name="email" id="email-input" value="">
                        </div>
                        <div class="info-item">
                            <label>电话</label>
                            <input type="text" name="phone" id="phone-input" value="">
                        </div>
                        <div class="info-item">
                            <label>期望职位</label>
                            <input type="text" name="expected_position" id="expected-position-input" value="">
                        </div>
                        <div class="info-item">
                            <label>期望薪资</label>
                            <input type="text" name="expected_salary" id="expected-salary-input" value="">
                        </div>
                        <div class="info-item">
                            <label>密码</label>
                            <input type="password" name="password" id="password-input" value="">
                        </div>
                        <div class="info-item">
                            <label>确认密码</label>
                            <input type="password" name="confirm_password" id="confirm-password-input" value="">
                        </div>
                    </div>
                    <button type="submit" class="btn btn-primary">保存</button>
                </form>
            </div>
        </div>
    </div>
</div>


    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 页面加载时获取用户信息
        window.onload = function() {
            fetch('/api/users')
                .then(response => response.json())
                .then(data => {
                    if (data.success) {
                        const user = data.user;
                         console.log('User:', user); // 调试信息
                        document.getElementById('full-name').innerText = user.full_name;
                        document.getElementById('expected-position').innerText = user.expected_position;
                        document.getElementById('expected-position-show').innerText = user.expected_position;
                        document.getElementById('full-name-show').innerText = user.full_name;
                        document.getElementById('expected-salary-show').innerText = user.expected_salary;
                        document.getElementById('email-show').innerText = user.email;
                        document.getElementById('phone-show').innerText = user.phone;

                        // 填充表单字段
                  document.getElementById('full-name-input').value = user.full_name;
                  document.getElementById('email-input').value = user.email;
                  document.getElementById('phone-input').value = user.phone;
                  document.getElementById('expected-position-input').value = user.expected_position;
                  document.getElementById('expected-salary-input').value = user.expected_salary;

                    } else {
                        alert('获取用户信息失败，请重试。');
                    }
                });
        };

         document.getElementById('edit-profile-btn').addEventListener('click', function() {
        // 显示模态框
        var modal = new bootstrap.Modal(document.getElementById('editProfileModal'));
        modal.show();
    });

    document.getElementById('profile-form').addEventListener('submit', function(event) {
        event.preventDefault();
        // 检查密码是否一致
        const password = document.getElementById('password-input').value;
        const confirmPassword = document.getElementById('confirm-password-input').value;
        if (password !== confirmPassword) {
            alert('两次输入的密码不一致，请重新输入。');
            return;
        }

        // 发送AJAX请求更新用户信息
        fetch('/api/users/update', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                full_name: document.querySelector('input[name="full_name"]').value,
                email: document.querySelector('input[name="email"]').value,
                phone: document.querySelector('input[name="phone"]').value,
                expected_position: document.querySelector('input[name="expected_position"]').value,
                expected_salary: document.querySelector('input[name="expected_salary"]').value,
                password: password
            })
        }).then(response => response.json())
          .then(data => {
              if (data.success) {
                  alert('信息更新成功！');
                  // 关闭模态框
                  var modal = bootstrap.Modal.getInstance(document.getElementById('editProfileModal'));
                  modal.hide();

                  // 更新页面显示
                  const user = data.user;
                  document.getElementById('full-name').innerText = user.full_name;
                  document.getElementById('expected-position').innerText = user.expected_position;
                  document.getElementById('expected-position-show').innerText = user.expected_position;
                  document.getElementById('full-name-show').innerText = user.full_name;
                  document.getElementById('expected-salary-show').innerText = user.expected_salary;
                  document.getElementById('email-show').innerText = user.email;
                  document.getElementById('phone-show').innerText = user.phone;

                  // 填充表单字段
                  document.getElementById('full-name-input').value = user.full_name;
                  document.getElementById('email-input').value = user.email;
                  document.getElementById('phone-input').value = user.phone;
                  document.getElementById('expected-position-input').value = user.expected_position;
                  document.getElementById('expected-salary-input').value = user.expected_salary;
              } else {
                  alert('信息更新失败，请重试。');
              }
          });
    });
</script>


    </script>
</body>
</html>

